namespace DingHeng.TransportationManagement.Entity
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel.DataAnnotations;
    using System.ComponentModel.DataAnnotations.Schema;
    using System.Data.Entity.Spatial;
    using DingHeng.TransportationManagement.Entity.Constant;

    [Serializable]
    public partial class User
    {
        public DateTime ShiftDate
        {
            get
            {
                if (DateTime.Now.Hour >= 0 && DateTime.Now.Hour < 8)
                {
                    return DateTime.Now.AddDays(-1).Date;
                }
                else
                {
                    return DateTime.Now.Date;

                }
            }
        }

        public string ShiftType {
            get {
                if (DateTime.Now.Hour >= 0 && DateTime.Now.Hour < 8)
                {
                    return StringConstant.ShiftTypeNight;
                }
                else
                {
                    if (DateTime.Now.Hour >= 8 && DateTime.Now.Hour < 20)
                    {
                        return StringConstant.ShiftTypeDay;
                    }
                    else
                    {
                        return StringConstant.ShiftTypeNight;
                    }
                }
            }
        }
    }
}
